package com.hexiang.subscribe;

import com.google.common.eventbus.Subscribe;
import com.hexiang.entity.UserAddedEvent;
import com.hexiang.service.NoticeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Slf4j
public class UserAddedEventListener {
    @Resource
    private NoticeService noticeService;

    @Subscribe
    public void userAdded(UserAddedEvent userAddedEvent) {
        log.info("userAdded :{}", userAddedEvent);
        noticeService.notice(userAddedEvent.getUser());
    }

}